package ch.exploadingelephants.graph;

/**
 * @author Sandro De Zanet
 * 
 */
public class VisitedNodeState {

    private final Token startToken;
    private final DotString inputPattern;

    /**
     * @param startToken
     * @param inputPattern
     */
    public VisitedNodeState(Token startToken, DotString inputPattern) {
	this.startToken = startToken;
	this.inputPattern = inputPattern;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
	return startToken.hashCode() + inputPattern.hashCode();
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object o) {
	if (o != null) {
	    if (o.getClass().equals(this.getClass())) {
		VisitedNodeState other = (VisitedNodeState) o;
		return other.inputPattern.equals(this.inputPattern)
			&& other.startToken == this.startToken;
	    }
	}
	return false;

    }

}
